/*
 * This class was automatically generated with 
 * <a href="http://www.castor.org">Castor 1.0.4</a>, using an XML
 * Schema.
 * $Id$
 */

package com.jzhao.jpre.format.sequential.castor;

  //---------------------------------/
 //- Imported classes and packages -/
//---------------------------------/

import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;

/**
 * Class ISO8583MsgField.
 * 
 * @version $Revision$ $Date$
 */
public class ISO8583MsgField implements java.io.Serializable {


      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * Field _fieldNumber
     */
    private int _fieldNumber;

    /**
     * keeps track of state for field: _fieldNumber
     */
    private boolean _has_fieldNumber;

    /**
     * Field _isLengthBCD
     */
    private boolean _isLengthBCD;

    /**
     * keeps track of state for field: _isLengthBCD
     */
    private boolean _has_isLengthBCD;

    /**
     * Field _isBCD
     */
    private boolean _isBCD;

    /**
     * keeps track of state for field: _isBCD
     */
    private boolean _has_isBCD;

    /**
     * Field _isMac
     */
    private boolean _isMac;

    /**
     * keeps track of state for field: _isMac
     */
    private boolean _has_isMac;

    /**
     * Field _padding
     */
    private java.lang.String _padding;

    /**
     * Field _align
     */
    private java.lang.String _align;

    /**
     * Field _fieldElementList
     */
    private java.util.Vector _fieldElementList;

    /**
     * Field _ISO8583MsgFieldChoice
     */
    private com.jzhao.jpre.format.sequential.castor.ISO8583MsgFieldChoice _ISO8583MsgFieldChoice;


      //----------------/
     //- Constructors -/
    //----------------/

    public ISO8583MsgField() 
     {
        super();
        this._fieldElementList = new java.util.Vector();
    } //-- com.jzhao.jpre.format.sequential.castor.ISO8583MsgField()


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * 
     * 
     * @param vFieldElement
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void addFieldElement(com.jzhao.jpre.format.sequential.castor.FieldElement vFieldElement)
        throws java.lang.IndexOutOfBoundsException
    {
        this._fieldElementList.addElement(vFieldElement);
    } //-- void addFieldElement(com.jzhao.jpre.format.sequential.castor.FieldElement) 

    /**
     * 
     * 
     * @param index
     * @param vFieldElement
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void addFieldElement(int index, com.jzhao.jpre.format.sequential.castor.FieldElement vFieldElement)
        throws java.lang.IndexOutOfBoundsException
    {
        this._fieldElementList.add(index, vFieldElement);
    } //-- void addFieldElement(int, com.jzhao.jpre.format.sequential.castor.FieldElement) 

    /**
     */
    public void deleteFieldNumber()
    {
        this._has_fieldNumber= false;
    } //-- void deleteFieldNumber() 

    /**
     */
    public void deleteIsBCD()
    {
        this._has_isBCD= false;
    } //-- void deleteIsBCD() 

    /**
     */
    public void deleteIsLengthBCD()
    {
        this._has_isLengthBCD= false;
    } //-- void deleteIsLengthBCD() 

    /**
     */
    public void deleteIsMac()
    {
        this._has_isMac= false;
    } //-- void deleteIsMac() 

    /**
     * Method enumerateFieldElement
     * 
     * 
     * 
     * @return an Enumeration over all
     * com.jzhao.jpre.format.sequential.castor.FieldElement
     * elements
     */
    public java.util.Enumeration enumerateFieldElement()
    {
        return this._fieldElementList.elements();
    } //-- java.util.Enumeration enumerateFieldElement() 

    /**
     * Returns the value of field 'align'.
     * 
     * @return the value of field 'Align'.
     */
    public java.lang.String getAlign()
    {
        return this._align;
    } //-- java.lang.String getAlign() 

    /**
     * Method getFieldElement
     * 
     * 
     * 
     * @param index
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     * @return the value of the
     * com.jzhao.jpre.format.sequential.castor.FieldElement at
     * the given index
     */
    public com.jzhao.jpre.format.sequential.castor.FieldElement getFieldElement(int index)
        throws java.lang.IndexOutOfBoundsException
    {
        // check bounds for index
        if (index < 0 || index >= this._fieldElementList.size()) {
            throw new IndexOutOfBoundsException("getFieldElement: Index value '" + index + "' not in range [0.." + (this._fieldElementList.size() - 1) + "]");
        }
        
        return (com.jzhao.jpre.format.sequential.castor.FieldElement) _fieldElementList.get(index);
    } //-- com.jzhao.jpre.format.sequential.castor.FieldElement getFieldElement(int) 

    /**
     * Method getFieldElement
     * 
     * 
     * 
     * @return this collection as an Array
     */
    public com.jzhao.jpre.format.sequential.castor.FieldElement[] getFieldElement()
    {
        int size = this._fieldElementList.size();
        com.jzhao.jpre.format.sequential.castor.FieldElement[] array = new com.jzhao.jpre.format.sequential.castor.FieldElement[size];
        for (int index = 0; index < size; index++){
            array[index] = (com.jzhao.jpre.format.sequential.castor.FieldElement) _fieldElementList.get(index);
        }
        
        return array;
    } //-- com.jzhao.jpre.format.sequential.castor.FieldElement[] getFieldElement() 

    /**
     * Method getFieldElementCount
     * 
     * 
     * 
     * @return the size of this collection
     */
    public int getFieldElementCount()
    {
        return this._fieldElementList.size();
    } //-- int getFieldElementCount() 

    /**
     * Returns the value of field 'fieldNumber'.
     * 
     * @return the value of field 'FieldNumber'.
     */
    public int getFieldNumber()
    {
        return this._fieldNumber;
    } //-- int getFieldNumber() 

    /**
     * Returns the value of field 'ISO8583MsgFieldChoice'.
     * 
     * @return the value of field 'ISO8583MsgFieldChoice'.
     */
    public com.jzhao.jpre.format.sequential.castor.ISO8583MsgFieldChoice getISO8583MsgFieldChoice()
    {
        return this._ISO8583MsgFieldChoice;
    } //-- com.jzhao.jpre.format.sequential.castor.ISO8583MsgFieldChoice getISO8583MsgFieldChoice() 

    /**
     * Returns the value of field 'isBCD'.
     * 
     * @return the value of field 'IsBCD'.
     */
    public boolean getIsBCD()
    {
        return this._isBCD;
    } //-- boolean getIsBCD() 

    /**
     * Returns the value of field 'isLengthBCD'.
     * 
     * @return the value of field 'IsLengthBCD'.
     */
    public boolean getIsLengthBCD()
    {
        return this._isLengthBCD;
    } //-- boolean getIsLengthBCD() 

    /**
     * Returns the value of field 'isMac'.
     * 
     * @return the value of field 'IsMac'.
     */
    public boolean getIsMac()
    {
        return this._isMac;
    } //-- boolean getIsMac() 

    /**
     * Returns the value of field 'padding'.
     * 
     * @return the value of field 'Padding'.
     */
    public java.lang.String getPadding()
    {
        return this._padding;
    } //-- java.lang.String getPadding() 

    /**
     * Method hasFieldNumber
     * 
     * 
     * 
     * @return true if at least one FieldNumber has been added
     */
    public boolean hasFieldNumber()
    {
        return this._has_fieldNumber;
    } //-- boolean hasFieldNumber() 

    /**
     * Method hasIsBCD
     * 
     * 
     * 
     * @return true if at least one IsBCD has been added
     */
    public boolean hasIsBCD()
    {
        return this._has_isBCD;
    } //-- boolean hasIsBCD() 

    /**
     * Method hasIsLengthBCD
     * 
     * 
     * 
     * @return true if at least one IsLengthBCD has been added
     */
    public boolean hasIsLengthBCD()
    {
        return this._has_isLengthBCD;
    } //-- boolean hasIsLengthBCD() 

    /**
     * Method hasIsMac
     * 
     * 
     * 
     * @return true if at least one IsMac has been added
     */
    public boolean hasIsMac()
    {
        return this._has_isMac;
    } //-- boolean hasIsMac() 

    /**
     * Returns the value of field 'isBCD'.
     * 
     * @return the value of field 'IsBCD'.
     */
    public boolean isIsBCD()
    {
        return this._isBCD;
    } //-- boolean isIsBCD() 

    /**
     * Returns the value of field 'isLengthBCD'.
     * 
     * @return the value of field 'IsLengthBCD'.
     */
    public boolean isIsLengthBCD()
    {
        return this._isLengthBCD;
    } //-- boolean isIsLengthBCD() 

    /**
     * Returns the value of field 'isMac'.
     * 
     * @return the value of field 'IsMac'.
     */
    public boolean isIsMac()
    {
        return this._isMac;
    } //-- boolean isIsMac() 

    /**
     * Method isValid
     * 
     * 
     * 
     * @return true if this object is valid according to the schema
     */
    public boolean isValid()
    {
        try {
            validate();
        }
        catch (org.exolab.castor.xml.ValidationException vex) {
            return false;
        }
        return true;
    } //-- boolean isValid() 

    /**
     * 
     * 
     * @param out
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     */
    public void marshal(java.io.Writer out)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        
        Marshaller.marshal(this, out);
    } //-- void marshal(java.io.Writer) 

    /**
     * 
     * 
     * @param handler
     * @throws java.io.IOException if an IOException occurs during
     * marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     */
    public void marshal(org.xml.sax.ContentHandler handler)
        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        
        Marshaller.marshal(this, handler);
    } //-- void marshal(org.xml.sax.ContentHandler) 

    /**
     */
    public void removeAllFieldElement()
    {
        this._fieldElementList.clear();
    } //-- void removeAllFieldElement() 

    /**
     * Method removeFieldElement
     * 
     * 
     * 
     * @param vFieldElement
     * @return true if the object was removed from the collection.
     */
    public boolean removeFieldElement(com.jzhao.jpre.format.sequential.castor.FieldElement vFieldElement)
    {
        boolean removed = _fieldElementList.remove(vFieldElement);
        return removed;
    } //-- boolean removeFieldElement(com.jzhao.jpre.format.sequential.castor.FieldElement) 

    /**
     * Method removeFieldElementAt
     * 
     * 
     * 
     * @param index
     * @return the element removed from the collection
     */
    public com.jzhao.jpre.format.sequential.castor.FieldElement removeFieldElementAt(int index)
    {
        Object obj = this._fieldElementList.remove(index);
        return (com.jzhao.jpre.format.sequential.castor.FieldElement) obj;
    } //-- com.jzhao.jpre.format.sequential.castor.FieldElement removeFieldElementAt(int) 

    /**
     * Sets the value of field 'align'.
     * 
     * @param align the value of field 'align'.
     */
    public void setAlign(java.lang.String align)
    {
        this._align = align;
    } //-- void setAlign(java.lang.String) 

    /**
     * 
     * 
     * @param index
     * @param vFieldElement
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void setFieldElement(int index, com.jzhao.jpre.format.sequential.castor.FieldElement vFieldElement)
        throws java.lang.IndexOutOfBoundsException
    {
        // check bounds for index
        if (index < 0 || index >= this._fieldElementList.size()) {
            throw new IndexOutOfBoundsException("setFieldElement: Index value '" + index + "' not in range [0.." + (this._fieldElementList.size() - 1) + "]");
        }
        
        this._fieldElementList.set(index, vFieldElement);
    } //-- void setFieldElement(int, com.jzhao.jpre.format.sequential.castor.FieldElement) 

    /**
     * 
     * 
     * @param vFieldElementArray
     */
    public void setFieldElement(com.jzhao.jpre.format.sequential.castor.FieldElement[] vFieldElementArray)
    {
        //-- copy array
        _fieldElementList.clear();
        
        for (int i = 0; i < vFieldElementArray.length; i++) {
                this._fieldElementList.add(vFieldElementArray[i]);
        }
    } //-- void setFieldElement(com.jzhao.jpre.format.sequential.castor.FieldElement) 

    /**
     * Sets the value of field 'fieldNumber'.
     * 
     * @param fieldNumber the value of field 'fieldNumber'.
     */
    public void setFieldNumber(int fieldNumber)
    {
        this._fieldNumber = fieldNumber;
        this._has_fieldNumber = true;
    } //-- void setFieldNumber(int) 

    /**
     * Sets the value of field 'ISO8583MsgFieldChoice'.
     * 
     * @param ISO8583MsgFieldChoice the value of field
     * 'ISO8583MsgFieldChoice'.
     */
    public void setISO8583MsgFieldChoice(com.jzhao.jpre.format.sequential.castor.ISO8583MsgFieldChoice ISO8583MsgFieldChoice)
    {
        this._ISO8583MsgFieldChoice = ISO8583MsgFieldChoice;
    } //-- void setISO8583MsgFieldChoice(com.jzhao.jpre.format.sequential.castor.ISO8583MsgFieldChoice) 

    /**
     * Sets the value of field 'isBCD'.
     * 
     * @param isBCD the value of field 'isBCD'.
     */
    public void setIsBCD(boolean isBCD)
    {
        this._isBCD = isBCD;
        this._has_isBCD = true;
    } //-- void setIsBCD(boolean) 

    /**
     * Sets the value of field 'isLengthBCD'.
     * 
     * @param isLengthBCD the value of field 'isLengthBCD'.
     */
    public void setIsLengthBCD(boolean isLengthBCD)
    {
        this._isLengthBCD = isLengthBCD;
        this._has_isLengthBCD = true;
    } //-- void setIsLengthBCD(boolean) 

    /**
     * Sets the value of field 'isMac'.
     * 
     * @param isMac the value of field 'isMac'.
     */
    public void setIsMac(boolean isMac)
    {
        this._isMac = isMac;
        this._has_isMac = true;
    } //-- void setIsMac(boolean) 

    /**
     * Sets the value of field 'padding'.
     * 
     * @param padding the value of field 'padding'.
     */
    public void setPadding(java.lang.String padding)
    {
        this._padding = padding;
    } //-- void setPadding(java.lang.String) 

    /**
     * Method unmarshal
     * 
     * 
     * 
     * @param reader
     * @throws org.exolab.castor.xml.MarshalException if object is
     * null or if any SAXException is thrown during marshaling
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     * @return the unmarshaled
     * com.jzhao.jpre.format.sequential.castor.ISO8583MsgField
     */
    public static com.jzhao.jpre.format.sequential.castor.ISO8583MsgField unmarshal(java.io.Reader reader)
        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
    {
        return (com.jzhao.jpre.format.sequential.castor.ISO8583MsgField) Unmarshaller.unmarshal(com.jzhao.jpre.format.sequential.castor.ISO8583MsgField.class, reader);
    } //-- com.jzhao.jpre.format.sequential.castor.ISO8583MsgField unmarshal(java.io.Reader) 

    /**
     * 
     * 
     * @throws org.exolab.castor.xml.ValidationException if this
     * object is an invalid instance according to the schema
     */
    public void validate()
        throws org.exolab.castor.xml.ValidationException
    {
        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
        validator.validate(this);
    } //-- void validate() 

}
